<template>
  <view class="ver-layout page-layout">
    <view class="ver-layout-center top-layout">
      <view class="text">Cash for free!!!</view>
      <view class="text">No limits</view>
      <view class="invite-btn hor-layout-center">
        <text style="margin-right: 5px">Inviting guide</text>
        <u-icon name="arrow-right" color="white" size="12"></u-icon>
      </view>
      <!--  分享的信息    -->
      <view class="card-layout ver-layout-center" style="margin-top: 25%">
        <view style="font-weight: bold">-My rewards-</view>
        <view class="hor-layout-around card-content" style="width: 100%">
          <view class="ver-layout-center">
            <view style="font-weight: bolder">0</view>
            <view>ranking</view>
          </view>
          <view class="ver-layout-center">
            <view style="font-weight: bolder">0</view>
            <view>ranking</view>
          </view>
          <view class="ver-layout-center">
            <view style="font-weight: bolder">0</view>
            <view>ranking</view>
          </view>
        </view>
        <u-button type="primary" text="Share Now For Cash"></u-button>
      </view>
      <!--  分享的功能    -->
      <view class="card-layout ver-layout-center" style="margin-top: 20px">
        <view class="hor-layout-side-center share-action-item" @click="shareByAddress">
          <view>Share by address list</view>
          <u-icon name="share" size="20" color="blue"></u-icon>
        </view>
        <view class="hor-layout-side-center share-action-item" @click="shareByCode">
          <view>Share by wap</view>
          <u-icon name="share" size="20" color="blue"></u-icon>
        </view>
        <view class="hor-layout-side-center share-action-item" @click="shareByCode">
          <view>Share by inviting code</view>
          <u-icon name="share" size="20" color="blue"></u-icon>
        </view>
      </view>
      <!-- 排行榜 -->
      <view class="card-layout ver-layout" style="margin-top: 20px;margin-bottom: 50px">
        <u-notice-bar :text="noticeText" fontSize="10" direction="column" icon="star"></u-notice-bar>
        <uni-table border stripe emptyText="暂无更多数据">
          <!-- 表头行 -->
          <uni-tr>
            <uni-th class="table-title" align="center" width="50">Ranking</uni-th>
            <uni-th class="table-title" align="center" width="70">Username</uni-th>
            <uni-th class="table-title" align="center" width="70">People invited</uni-th>
            <uni-th class="table-title" align="center" width="50">Inviting Rewards</uni-th>
          </uni-tr>
          <!-- 表格数据行 -->
          <uni-tr v-for="(item,index) in rankList" :key="index">
            <uni-td>{{ item.num }}</uni-td>
            <uni-td>{{ item.name }}</uni-td>
            <uni-td>{{ item.invited }}</uni-td>
            <uni-td>{{ item.rewards }}</uni-td>
          </uni-tr>
        </uni-table>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: "inviteFriend",
  data() {
    return {
      noticeText: [
        'aaa wins N500 5min ago for inviting a new user to sell cards successfully',
        'bbb wins N500 5min ago for inviting a new user to sell cards successfully',
        'ccc wins N500 5min ago for inviting a new user to sell cards successfully',
        'ddd wins N500 5min ago for inviting a new user to sell cards successfully',
      ],
      rankList: [
        {num: 1, name: 'S****E', invited: '49', rewards: 'N89989'},
        {num: 2, name: 'S****E', invited: '12', rewards: 'N89989'},
        {num: 3, name: 'S****E', invited: '43', rewards: 'N89989'},
        {num: -1, name: 'S****E', invited: '53', rewards: 'N89989'},
      ]
    }
  },
  methods: {
    shareByAddress() {

    },
    shareByCode() {
      uni.setClipboardData({
        data: 'hello',
        success: () => {
          this.$tools.showToast("复制成功！")
        }
      });
    }
  }
}
</script>

<style scoped lang="scss">
.page-layout {
  min-height: calc(100vh - 44px);
  //background: linear-gradient(to bottom, #55BBB3 0%, #3bb2b8 100%);
  //background: linear-gradient(to bottom, #55BBB3 0%, #42e695 100%);
  background: linear-gradient(to bottom, #55BBB3 0%, #abdcff 100%);
}

.top-layout {
  margin-top: 20px;

  .text {
    color: #ed8f03;
    font-size: xx-large;
    font-weight: bolder;
    line-height: 40px;
  }
}

.invite-btn {
  margin-top: 30px;
  color: white;
  font-size: small;
  padding: 5px 12px;
  border-radius: 4px;
  background: linear-gradient(to right, #ed8f03 0%, #ffb75e 100%);
}

.card-layout {
  padding: 10px;
  margin: auto;
  width: calc(100% - 10 * 2px - 10 * 2px);
  background: white;
  border-radius: 10px;
}

.card-content {
  margin-top: 30px;
  margin-bottom: 20px;
}

.share-action-item {
  width: 100%;
  height: 45px;
  line-height: 45px;
  font-size: small;
  border-bottom: 1px solid #efefef;
}

.table-title {
  font-size: small;
  color: #3e3e65;
}
</style>
